package com.ruoyi.user_info.user_profile.domain.dto;

import com.ruoyi.user_info.user_profile.domain.UserProfile;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class UserProfileDTO {
    private String name;
    private String idNumber;
    private String phoneNumber;
    private String gender;
    private Long annualIncome;
    private String county;
    private String education;
    private Boolean hasHouse;
    private Boolean hasCar;

    public UserProfile toUserProfile() {
        UserProfile profile = new UserProfile();
        profile.setName(this.name);
        profile.setIdNumber(this.idNumber);
        profile.setPhoneNumber(this.phoneNumber);
        profile.setGender(this.gender);
        profile.setAnnualIncome(this.annualIncome);
        profile.setCounty(this.county);
        profile.setEducation(this.education);
        profile.setHasHouse(this.hasHouse != null ? (this.hasHouse ? 1 : 0) : null);
        profile.setHasCar(this.hasCar != null ? (this.hasCar ? 1 : 0) : null);
        return profile;
    }
}
